package com.stenio.fancat.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.stenio.fancat.domain.bo.ActOperLogBO;
import com.stenio.fancat.form.ActOperLogForm;
import com.stenio.fancat.service.MessageService;
import com.stenio.fancat.util.ResultUtil;
import com.stenio.fancat.vo.Result;

/**
 * 消息模块controller
 */
@RestController
@RequestMapping("msg")
public class MessageController {

	@Autowired
	private MessageService messageService;

	/**
	 * 获取首页面频道
	 * 
	 * @return
	 */
	@PostMapping("new")
	public Result newMsg(@RequestBody ActOperLogForm actOperLogForm) {
		List<ActOperLogBO> list;
		try {
			list = messageService.queryUserMsg(actOperLogForm);
		} catch (Exception e) {
			e.printStackTrace();
			return ResultUtil.error("1", e.getMessage());
		}
		JSONObject jobj = new JSONObject();
		jobj.put("list", list);
		return ResultUtil.success(jobj);
	}
}
